import { defineStore } from "pinia";
import { get_imag, delete_img } from "@/apis/AlbumApi";
import { type deletype } from "@/types/Albums";
import { ElMessage } from "element-plus";
const AlbumsStore = defineStore('albums', () => {
    const get_list = async (data: { year: number, month: number }, id: number) => {
        const result = await get_imag(data, id)
        return result
    }
    const img_delete = async (data: deletype) => {
        const result: any = await delete_img(data)
        console.log(result, '三处')
        if (result.code == 200) {
            ElMessage({
                type: "success",
                message: "删除成功"
            })
        } else {
            ElMessage({
                type: "error",
                message: "删除失败"
            })
        }
    }
    return {
        get_list,
        img_delete
    }
})


export default AlbumsStore